from typing import Optional

from sqlmodel import Field
from app.models.login_log import BaseLog
from ..models.base import SQLBaseModel


class BaseOperationLog(BaseLog):
    api_label: Optional[str] = Field(default=None, index=True, description="接口名称")
    http_method: str = Field(description="接口方法")
    params: Optional[str] = Field(default=None, description="操作参数")


class OperationLog(SQLBaseModel, BaseOperationLog, table=True):
    __tablename__ = "operation_log"
